package com.itheima.d2_byte_stream;

import java.io.FileInputStream;
import java.io.FileOutputStream;

/*
     目标：掌握文件字节输出流FileOutputStream的使用。
     构造器：
          public FileOutputStream(String name, boolean append)
          public FileOutputStream(File file, boolean append)


     换行符(返回值是String类型)：System.lineSeparator()
 */
public class FileOutputStreamTest4 {
    public static void main(String[] args) throws Exception{
        FileInputStream fis = new FileInputStream("a.png");
        FileOutputStream ops = new FileOutputStream("b.png");
        byte[] bytes = new byte[5];
        int len;
        while ((len = fis.read(bytes)) != -1) {
            ops.write(bytes, 0, len);
        }

        ops.close();
        fis.close();
    }
}
